<template>
    <div>
        <div class="e-form">
            <div class="tabs" style="margin-bottom:120px">
                <div class="tabs-title">基本信息</div>
                <div style="width: 100%" class="form">
                    <el-form :model="formData" :label-width="formLabelWidth">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="业主合同：">
                                    <span>{{}}</span>
                                    <!-- <el-input v-model="formData.ctName" autocomplete="off"></el-input> -->
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="编制机构：">
                                    <span>{{}}</span>
                                    <!-- <el-input v-model="formData.ctName" autocomplete="off"></el-input> -->
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="计量时间：">
                                    <span>{{}}</span>
                                    <!-- <el-input v-model="formData.ctName" autocomplete="off"></el-input> -->
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="业主单位：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="本期计量总金额(元)：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="截止上期末累计计量总金额(元)：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="自开工累计完成总金额(元)：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="录入人：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="录入时间：">
                                    <span>{{}}</span>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="24">
                                <el-form-item label="补充说明/备注：">
                                    <el-input type="textarea" v-model="formData.ctPrimarycoverage" autocomplete="off"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </div>
            </div>
            <div class="buttons">
                <el-button type="primary" size="small" style="background: #2e61d7" @click="addSave"
                    >保存</el-button
                >
                <el-button size="small" @click="handleClose">关闭</el-button>
            </div>
        </div>
    </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
    data () {
        return {
            //基础信息
            formData: {
                'advanceCharge': null,
                'aname': '',
                'applicationStatus': '',
                'baseCurrency': null,
                'baseRate': null,
                'bcAdvanceCharge': null,
                'bcCtMoney': null,
                'bcPerformanceBond': null,
                'bname': '',
                'cashPledge': null,
                'cashPledges': null,
                'changeAdvanceCharge': null,
                'changeCode': '',
                'changeCtMoney': null,
                'changeNumber': null,
                'ctAddressCode': '',
                'ctCode': '',
                'ctMoney': null,
                'ctName': '',
                'ctPrimarycoverage': '',
                'ctState': null,
                'ctType': null,
                'ctsubcontractId': '',
                'financialSharing': null,
                'freightTaxRate': null,
                'gmtCreate': '',
                'gmtModified': '',
                'guaranteedAmount': null,
                'handler': '',
                'importId': '',
                'importName': '',
                'intoMoney': null,
                'isDelete': null,
                'isPerformanceBond': null,
                'isTax': null,
                'leasePlan': '',
                'notTaxprice': null,
                'nullifyCreated': '',
                'nullifyCreator': '',
                'nullifyCreatorId': '',
                'nullifyDesciption': '',
                'nullifyReason': '',
                'orgId': '',
                'organization': '',
                'outMoney': null,
                'signatory': '',
                'signatoryAddress': '',
                'signingDate': '',
                'supplier': '',
                'taxAmount': null,
                'taxRate': null,
                'transportationCost': null,
                'userId': '',
                'validity1': '',
                'validity2': ''
            },
            formLabelWidth: '220px',
            ctAddressCode: []
        }
    },
    mounted () {
        this.getUserInfo()
    },
    components: {
    },
    computed: {
        ...mapState({
            options: state => state.contract.ctClassify,
            userInfo: state => state.userInfo
        })
    },
    methods: {
        //默认获取用户信息
        getUserInfo () {
            this.formData.importId = localStorage.userId
            this.formData.importName = localStorage.userName
            this.formData.orgId = this.userInfo.orgInfo.orgId
            this.formData.organization = this.userInfo.orgInfo.orgName  //所属机构
            this.formData.handler = localStorage.userName
        },
        // 获取地址对应中文
        getAddrLabel (val) {
            this.formData.signatoryAddress = val.join('-')
        },
        //基本信息保存
        addSave () {
            if(this.ctAddressCode.length > 0) {
                this.formData.ctAddressCode = this.ctAddressCode.join('-') //行政编码
            }
            this.$Ajax.httpPost({
                url: '/contract/CtConveyancePsdreparationd/saveOne',
                params: this.formData
            }).then(() => {
                this.$message.success('保存成功')
                this.$router.push('/landlordMetering')

            })
        },
        //取消
        handleClose () {
            this.$router.push('/landlordMetering')
        },
    },
}

</script>

<style lang='scss' scoped>
.buttons {
    left: 0;
}
.e-form {
    padding: 0 20px;
    .tabs-title::before {
        content: '';
        height: 22px;
        width: 8px;
        border-radius: 40px;
        background-color: #2e61d7;
        display: block;
        position: absolute;
        left: 20px;
        margin-right: 20px;
    }
}
.e-table{
    min-height: auto;
    background: #fff;
}
.separ{
   width: 30px;
   height: 40px;
   line-height: 18px;
   text-align: center;
}
.upload {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    text-align: center;
}

.upload-demo {
    display: flex;
    justify-content: center;
    align-items: center;
}

::v-deep.el-input--suffix .el-input__inner {
    padding-right: 5px;
}
::v-deep.el-table .cell {
    text-align: center;
}
</style>